//****************************************************************/
//Creation History
// Company: GZ office
// NAME:    CostCenterProcess.java
// TITLE:   Cost Center Column Accessibility Maintenance 
// BY:      Oscar Bai
// DATE:    03/03/2003
//******************************************************************/
//Modification History
//******************************************************************/
//******************************************************************/


package admin.system.costcenter;

import com.ffpc.sql.*;

import java.util.Vector;
import java.sql.*;

public class CostCenterProcess{

    public static CostCenterBean createBean()
    {
        return new CostCenter();
    }

    public static int insert(Connection con, CostCenterBean costCenterBean)
      throws DataException
    {
        CostCenter costCenter = (CostCenter)costCenterBean;
        costCenter.setConnection(con);
        return costCenter.insert();
    }

    public static int update(Connection con, CostCenterBean costCenterBean)
      throws DataException
    {
        CostCenter costCenter = (CostCenter)costCenterBean;
        costCenter.setConnection(con);
        return costCenter.update();
    }

    public static int delete(Connection con, CostCenterBean costCenterBean)
      throws DataException
    {
        CostCenter costCenter = (CostCenter)costCenterBean;
        costCenter.setConnection(con);
        return costCenter.delete();
    }

    public static CostCenterBean[] find(Connection con, CostCenterBean costCenterBean)
      throws DataException
    {
        CostCenter costCenter = (CostCenter)costCenterBean;
        BaseSqlCommand buc = new BaseSqlCommand(con);
        Vector rows = buc.find(costCenter);
        CostCenterBean[] beans = new CostCenter[rows.size()];
        for (int i=0;i<rows.size();i++)
        {
            CostCenter bean = new CostCenter();
            bean.setColumns((Column[])rows.get(i));
            beans[i] = bean;
        }
        return beans;
    }  
}